import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DatePipe } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';

/* Pipes */
import { EnumPipe } from './pipes/enum.pipe';
import { PercentagePipe } from './pipes/percentage.pipe';
/* End Pipes */

/* Directives */
import { AuthDirective } from './directives/auth.directive';
/* End Directives */

/* 3rd Party */
import { NgZorroAntdModule, NZ_NOTIFICATION_CONFIG, NZ_MESSAGE_CONFIG } from 'ng-zorro-antd';
/* End 3rd Party */

/* Services */
import { DictService } from './services/dict.service';
import { UtilsService } from './services/utils.service';
import { ChannelManageService } from './services/channel.service';
import { LabelManageService } from './services/label.service';
import { MaterialManageService } from './services/material.service';
import { RecipesManageService } from './services/recipes.service';
import { LoginService } from './services/login.service';
import { HttpService } from './services/auth.service';
/* End Services */

/* Components */
import { MenuComponent } from './components/menu/menu.component';
/* End Components */

@NgModule({
  declarations: [
    MenuComponent,
    AuthDirective,
    EnumPipe,
    PercentagePipe,
  ],
  imports: [
    CommonModule,
    FormsModule,
    RouterModule,
    NgZorroAntdModule,
    ReactiveFormsModule
  ],
  exports: [
    CommonModule,
    FormsModule,
    AuthDirective,
    EnumPipe,
    PercentagePipe,
    ReactiveFormsModule,
    MenuComponent
  ],
  providers: [
  ],
  entryComponents: [
  ]
})
export class SharedModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: SharedModule,
      providers: [
        DatePipe,
        UtilsService,
        DictService,
        HttpService,
        LoginService,
        ChannelManageService,
        LabelManageService,
        MaterialManageService,
        RecipesManageService,
        { provide: NZ_NOTIFICATION_CONFIG, useValue: { nzDuration: 3000 } },
        { provide: NZ_MESSAGE_CONFIG, useValue: { nzDuration: 3000 } }
      ]
    }
  }

}
